<!DOCTYPE html>
<html xmlns:layout="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org"
	layout:decorate="~{common/layout}">

<head>
	<meta charset="UTF-8">
	<title>在线测验系统</title>
	<style scoped lang="less">
	 .my-swipe .van-swipe-item {
	    color: #fff;
	    font-size: 20px;
	    line-height: 150px;
	    text-align: center;
	    background-color: #39a9ed;
	  }
	</style>
</head>

<body>
	<div layout:fragment="fragment_body">
		<van-row>
			<van-swipe class="my-swipe" :autoplay="3000" indicator-color="white">
			  <van-swipe-item>章节练习</van-swipe-item>
			  <van-swipe-item>模拟测试</van-swipe-item>
			  <van-swipe-item>大量题目</van-swipe-item>
			</van-swipe>
		</van-row>
		<van-row style="margin-top:10px;">
			<van-grid :gutter="10">
			  <van-grid-item icon="label-o" text="章节练习" @click="goto(0)"></van-grid-item>
			  <van-grid-item icon="medal-o" text="模拟测试" @click="goImitate()" ></van-grid-item>
			</van-grid>
		</van-row>
	</div>
</body>
<script type="text/javascript" layout:fragment="fragment_script">
	let vueData = {
		activeMenu: 'index'
	}
	let vueComputed = {
		
	}
	let vueMethods = {
		goto(type){
			window.location.href = '/user/home?type=' + type
		},
		goImitate(){
			let that = this
			var initP = {
				init: true,
				accountId: getLoginId()
			}
			postRequst('/user/getImitate', initP, true).then(function (resp) {
				if(resp.status === 0){
					window.location.href = '/user/answer?rId=' + resp.data.recordId + '&index=0'
				}else{
					if(resp.msg === '请登录'){
						window.location.href = '/user/login'
					}else{
						that.$toast.fail(resp.msg);
					}
				}
			})
		}
	}
	function vueCreated() {
		let that = this
	}
</script>

</html>